home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 3 / Amiga Tools 3.iso / rexx / halftone.rexx < prev    next >
OS/2 REXX Batch file  |  1995-06-03  |  3KB  |  114 lines

  1. /**********************************/
  2. /* Image Engineer Macro script    */
  3. /* by Simon Edwards               */
  4. /* 3/6/95                         */
  5. /*                                */
  6. /* This lets you select an alpha  */ 
  7. /* channel image to be scaled and */
  8. /* used as a halftone pattern on  */
  9. /* the project.                   */
  10. /**********************************/
  11.  
  12. Options results
  13. signal on error            /* Setup a place for errors to go */
  14.  
  15. if arg()==0 then exit
  16.  
  17. TYPE 8BIT
  18.  
  19. menu=0
  20. done=0
  21. do while done=0
  22. select
  23.     when menu=0 then do
  24.         'REQUEST "Image to use for the halftone" "Spherical|Vertical|Horizontal|More.."'
  25.         reply=RESULT
  26.         select
  27.             when reply=1 then do
  28.                 'OPEN "IE:alpha/Spherical.alpha"'
  29.                 alphachannel=result
  30.                 CALL scalealpha
  31.                 done=1
  32.                 end
  33.             when reply=2 then do
  34.                 'OPEN "IE:alpha/Gradient.alpha"'
  35.                 alphachannel=result
  36.                 CALL scalealpha
  37.                 done=1
  38.                 end
  39.             when reply=3 then do
  40.                 'OPEN "IE:alpha/Gradient.alpha"'
  41.                 alphachannel=result
  42.                 'ROTATE '||alphachannel||' 90 FAST'
  43.                 tmp=result
  44.                 CLOSE alphachannel
  45.                 alphachannel=tmp
  46.                 CALL scalealpha
  47.                 done=1
  48.                 end
  49.             when reply=0 then menu=1
  50.         end
  51.         end
  52.     when menu=1 then do
  53.         'REQUEST "Image to use for the halftone" "Diagonal|Ordered4|Wavey|More.."'
  54.         reply=RESULT
  55.         select
  56.             when reply=1 then do
  57.                 'OPEN "IE:alpha/diagonal.alpha"'
  58.                 alphachannel=RESULT
  59.                 CALL scalealpha
  60.                 done=1
  61.                 end
  62.             when reply=2 then do
  63.                 'OPEN "IE:alpha/ordered4.alpha"'
  64.                 alphachannel=RESULT
  65.                 done=1
  66.                 end
  67.             when reply=3 then do
  68.                 'OPEN "IE:alpha/wavey.alpha"'
  69.                 alphachannel=RESULT
  70.                 CALL scalealpha
  71.                 done=1
  72.                 end
  73.             when reply=0 then menu=0
  74.         end
  75.         end
  76. end
  77. end
  78.  
  79.  
  80. MARK arg(1) PRIMARY
  81. MARK alphachannel ALPHA
  82. HALFTONE
  83. CLOSE alphachannel
  84. exit
  85.  
  86.  
  87. scalealpha:
  88.     'GET_NUMBER "Size in pixels" 4 256 "Ok|Cancel" 16'
  89.     size=result
  90.     SCALE alphachannel size size FAST
  91.     temp=RESULT
  92.     CLOSE alphachannel
  93.     alphachannel=temp
  94.     return
  95.  
  96.  
  97. /*******************************************************************/
  98. /* This is where control goes when an error code is returned by IE */
  99. /* It puts up a message saying what happened and on which line     */
  100. /*******************************************************************/
  101. error:
  102. if RC=5 then do            /* Did the user just cancel us? */
  103.     IE_TO_FRONT
  104.     LAST_ERROR
  105.     'REQUEST "'||RESULT||'"'
  106.     exit
  107. end
  108. else do
  109.     IE_TO_FRONT
  110.     LAST_ERROR
  111.     'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
  112.     exit
  113. end
  114.